﻿#pragma once
#include <QDialog>
#include <QTableWidget>
#include <QPushButton>
#include <QLineEdit>
#include <QLabel>
#include "UndoRedo_train.h"

class TrainAdminDialog : public QDialog {
    Q_OBJECT
public:
    TrainAdminDialog(QWidget* parent = nullptr);
    void refreshTrainTable();
private slots:
    void onAddTrain();
    void onDeleteTrain();
    void onEditTrain();
    void onSearchTrain();
    void updateRecordCount();
private:
    QTableWidget* table;
    QLineEdit* idEdit;
    QLineEdit* codeEdit;
    QLineEdit* startStationEdit;
    QLineEdit* endStationEdit;
    QLineEdit* searchEdit;
    QPushButton* addBtn;
    QPushButton* deleteBtn;
    QPushButton* editBtn;
	QPushButton* undoBtn;
	QPushButton* redoBtn;
    QPushButton* searchBtn;
    QLabel* infoLabel;
    QLabel* recordCountLabel;
    void showInfo(const QString& msg);
	UndoRedo_train undoRedo;  // 撤销重做管理器
};
